from abc import abstractmethod
from typing import Tuple, List, Union, Callable


class TelewebServer(object):
    PROGRESS_BEGIN = '==Progress Begin=='
    PROGRESS_END = '==Progress End=='

    @abstractmethod
    def ls(self) -> Tuple[List[str], List[str]]:
        pass

    @abstractmethod
    def ls_info(self) -> List[Tuple[str, str, str, str]]:
        """
        :return: name, type, date, path
        """
        pass

    @abstractmethod
    def cd(self, path: Union[str, int]) -> bool:
        pass

    @abstractmethod
    def pwd(self) -> str:
        pass

    @abstractmethod
    def is_sw_like(self, path: str = None) -> bool:
        pass

    @abstractmethod
    def download_dir(self, local_path: str, remote_path: Union[str, None],
                     download_sub_dir: bool = True,
                     on_progress: Callable[[str, int, int], None] = None):
        pass

    @abstractmethod
    def download_file(self, remote_path: str, on_progress: Callable[[str, int, int], None] = None) -> bytes:
        pass

    @abstractmethod
    def get_name(self, path: str) -> str:
        pass

    @abstractmethod
    def get_date(self, path: str) -> str:
        pass

    @abstractmethod
    def get_type(self, path: str) -> str:
        pass

    @abstractmethod
    def pushd(self):
        pass

    @abstractmethod
    def popd(self):
        pass
